package com.inoneone.youba.mcht.service;

import com.inoneone.youba.mcht.dao.po.*;
import com.inoneone.youba.mcht.dto.PageRsp;
import com.inoneone.youba.mcht.dto.req.AddSerialReq;
import com.inoneone.youba.mcht.dto.req.BeginOrderReq;
import com.inoneone.youba.mcht.dto.req.EndOrderReq;
import com.inoneone.youba.mcht.dto.req.FuelOrderReq;
import com.inoneone.youba.mcht.dto.rsp.Data7DayRsp;
import com.inoneone.youba.mcht.dto.rsp.FuelOrderRsp;
import org.springframework.transaction.annotation.Transactional;

public interface OrderApi {

    /**
     * Description: 查询最近七天加油、资金数据</br>
     * Date: 2017-06-21 09:24:34</br>
     *
     * @param
     * @return
     * @author 姬远玄
     * @since JDK 1.7
    */
    Data7DayRsp countByMch(String mchId);

    /**
     * Description: 查询加油订单</br>
     * Date: 2017-06-23 15:30:58</br>
     *
     * @param
     * @return
     * @author 姬远玄
     * @since JDK 1.7
    */
    PageRsp<FuelOrderRsp> fuelOrder(FuelOrderReq fuelOrderReq, String mchId);

    /**
     * Description: 获取业务锁</br>
     * Date: 2017-07-05 17:02:42</br>
     *
     * @param
     * @return
     * @author 姬远玄
     * @since JDK 1.7
    */
    BusinessLock getBusinessLock(String cardId);

    /**
     * Description: 加锁</br>
     * Date: 2017-07-05 17:02:55</br>
     *
     * @param
     * @return
     * @author 姬远玄
     * @since JDK 1.7
    */
    void lock(String cardId, FuelOrder fuelOrder);

    /**
     * Description: 解锁</br>
     * Date: 2017-07-05 17:03:04</br>
     *
     * @param
     * @return
     * @author 姬远玄
     * @since JDK 1.7
    */
    void unlock(String cardId);

    /**
     * Description: 创建订单</br>
     * Date: 2017-07-05 17:03:37</br>
     *
     * @param
     * @return
     * @author 姬远玄
     * @since JDK 1.7
    */
    FuelOrder createOrder(Card card, Tanker tanker);

    /**
     * Description: 查询订单</br>
     * Date: 2017-07-05 17:03:47</br>
     *
     * @param
     * @return
     * @author 姬远玄
     * @since JDK 1.7
    */
    FuelOrder queryOrder(Long orderId);

    /**
     * Description: 完结订单</br>
     * Date: 2017-07-05 17:04:02</br>
     *
     * @param
     * @return
     * @author 姬远玄
     * @since JDK 1.7
    */
    @Transactional
    void complateLastOrder(EndOrderReq endOrderReq, Merchant merchant, Card card, Tanker tanker);

    /**
     * Description: 写流水信息</br>
     * Date: 2017-07-19 18:53:22</br>
     *
     * @param
     * @return
     * @author 姬远玄
     * @since JDK 1.7
    */
    void addOrderFlow(FuelOrder fuelOrder, AddSerialReq addSerialReq);
}
